﻿using System;
using System.Windows;
using System.Windows.Media;

namespace FrontDisplay
{
    public class Gradient : IBackground
    {
        private readonly LinearGradientBrush _brush;

        public Gradient()
        {
            _brush = new LinearGradientBrush();

            _brush = new LinearGradientBrush
            {
                StartPoint = new Point(0, 1),
                EndPoint = new Point(0, 0)
            };

            _brush.GradientStops.Add(new GradientStop(ThemeManager.Current.BackgroundBottom, 0));
            _brush.GradientStops.Add(new GradientStop(ThemeManager.Current.Background, 0.5));
            _brush.GradientStops.Add(new GradientStop(ThemeManager.Current.BackgroundTop, 1));
        }

        public string Name
        {
            get { return "Gradient"; }
        }

        public Brush Brush
        {
            get { return _brush; }
        }

        public void UpdateColors()
        {
            _brush.GradientStops[0].Color = ThemeManager.BackgroundBottom.Color;
            _brush.GradientStops[1].Color = ThemeManager.Background.Color;
            _brush.GradientStops[2].Color = ThemeManager.BackgroundTop.Color;
        }
    }
}
